cmake_minimum_required(VERSION 3.0)

# 设置项目名称和语言
project(cloudbox C)
# 启用调试信息
set(CMAKE_BUILD_TYPE Debug)

# 查找 MySQL 库
if(NOT MySQL_FOUND)
    find_package(MySQL QUIET)
    if (NOT MySQL_FOUND)
        set(MYSQL_INCLUDE_DIRS "/usr/include/mysql")
        set(MYSQL_LIBRARIES "/usr/lib/x86_64-linux-gnu/libmysqlclient.so")
        set(MySQL_FOUND TRUE)
        message(STATUS "MYSQL_INCLUDE_DIRS = ${MYSQL_INCLUDE_DIRS}")
        message(STATUS "MYSQL_LIBRARIES = ${MYSQL_LIBRARIES}")
    endif()
endif()

# 查找 OpenSSL 库
find_package(OpenSSL QUIET)
if (OpenSSL_FOUND)
    message(STATUS "Found OpenSSL library")
else()
    message(WARNING "OpenSSL library not found")
endif()

# 查找 Redis（hiredis）
set(Hiredis_INCLUDE_DIRS "/usr/local/include/")
message(STATUS "Hiredis_INCLUDE_DIRS = ${Hiredis_INCLUDE_DIRS}")
set(Hiredis_LIBRARIES "/usr/local/lib/x86_64-linux-gnu/libhiredis.so")
message(STATUS "Hiredis_LIBRARIES = ${Hiredis_LIBRARIES}")
set(Hiredis_FOUND TRUE)



# 查找 FastCGI 库
find_package(FCGI QUIET)
if (NOT FCGI_FOUND)
    find_package(FCGI QUIET)
    if (NOT FCGI_FOUND)
        set(FCGI_INCLUDE_DIRS "/usr/local/include/")
        set(FCGI_LIBRARIES "/usr/local/lib/libfcgi.so")
        set(FCGI_FOUND TRUE)
        message(STATUS "FCGI_INCLUDE_DIRS = ${FCGI_INCLUDE_DIRS}")
        message(STATUS "FCGI_LIBRARIES = ${FCGI_LIBRARIES}")
    endif()
endif()

# 添加子目录
add_subdirectory(include/login)
add_subdirectory(include/register)
add_subdirectory(include/upload)